package com.qjsp.service.admin.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.qjsp.dao.admin.UserDao;
import com.qjsp.doman.User;
import com.qjsp.service.admin.UserService;

@Transactional(readOnly = true)
@Service("userService")
public class UserServiceImpl implements UserService{

	@Autowired
	UserDao userDao;
	
	
	
	public UserDao getUserDao() {
		return userDao;
	}

	@Override
	public List<User> selectAll() {
		// TODO Auto-generated method stub
		return userDao.selectAll();
	}

	@Override
	public User findById(String id) {
		// TODO Auto-generated method stub
		return userDao.findById(id);
	}

	@Override
	public User findByUserName(String userName) {
		// TODO Auto-generated method stub
		return userDao.findByUserName(userName);
	}

	@Override
	public int countAll() {
		// TODO Auto-generated method stub
		return userDao.countAll();
	}
   @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
	@Override
	public int insert(User user) {
		// TODO Auto-generated method stub
		return userDao.insert(user);
	}
	 @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
	@Override
	public int update(User user) {
		// TODO Auto-generated method stub
		return userDao.update(user);
	}

	@Override
	public int delete(String userName) {
		// TODO Auto-generated method stub
		return userDao.delete(userName);
	}

	
}
